<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<style>@namespace a "a"; div { }</style>
<style>@namespace a "a"; div { }</style>

<script>

test(function() {
  document.styleSheets[0].deleteRule(1);
  assert_equals(document.styleSheets[0].cssRules.length, 1);
  var rule = document.styleSheets[0].cssRules[0];
  assert_equals(rule.type, CSSRule.NAMESPACE_RULE);
  assert_equals(rule.namespaceURI, 'a');

  // The other stylesheet should not be affected.
  assert_equals(document.styleSheets[1].cssRules.length, 2);
  var rule1 = document.styleSheets[1].cssRules[0];
  assert_equals(rule1.type, CSSRule.NAMESPACE_RULE);
  assert_equals(rule1.namespaceURI, 'a');
  var rule2 = document.styleSheets[1].cssRules[1];
  assert_equals(rule2.type, CSSRule.STYLE_RULE);
  assert_equals(rule2.selectorText, 'div');
}, 'Access namespace rule after deleting child rule');

</script>
